package cn.com.yitong.demo.demo2.dao;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import cn.com.yitong.framework.core.util.query.Parameters;
import cn.com.yitong.framework.mybatis.MyBatisSupport;

/**
 * @ClassName: DemoMyBatisDaoImpl
 * @Description: DAO实现
 * @author: 孙孟（sm@yitong.com.cn）
 * @date: 2015-9-7 上午9:54:59
 */
public class DemoTable2DaoImpl extends MyBatisSupport<Object> implements DemoTable2Dao{

	/**
	 * sqlKey
	 */
	private final String SQLKEY = "sqlmap.DemoTable2";
	
	/**
	 * 查询所有记录
	 */
	@Override
	@SuppressWarnings("unchecked")
	public List<Map<String, Object>> queryAll(Parameters parameters) {
		//sql key
		String sqlKey = SQLKEY+".query";
		List<Map<String,Object>> list =(ArrayList<Map<String,Object>>) this.find(sqlKey, parameters);
		return list;
	}

	/**
	 * 插入记录
	 */
	@Override
	public boolean insertData(Map<String, Object> parameters) {
		//sql key
		String sqlKey = SQLKEY+".insert";
		//插入
		return this.insert(sqlKey, parameters);
	}

	/**
	 * 修改记录
	 */
	@Override
	public boolean updateById(Map<String, Object> parameters) {
		//sqlKey
		String sqlKey = SQLKEY+".update";
		//更新
		return this.update(sqlKey, parameters);
	}
}